<%@ page contentType="text/html; charset=utf-8"  %>
<%@ taglib uri="/WEB-INF/tld/c-1_0-rt.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt-1_0-rt.tld" prefix="fmt" %>
<%@ taglib uri="http://www.kevin.com/mytag" prefix="my" %>

<script type="text/javascript">
	window.UEDITOR_HOME_URL = '${pageContext.request.contextPath }/ueditor/',ueditor_loader={};
</script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath }/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath }/ueditor/editor_all.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/ueditor/themes/default/ueditor.css"/>
<title>显示文章列表</title>

<my:list var="fl" list="${obj.nav}" field="id"></my:list>
<script type="text/javascript">
	var navarr = [];
	$(document).ready(function(){
		var path = '${pageContext.request.contextPath}';
		load('${pageContext.request.contextPath }');
		//赋值
		$("#color").val('${obj.color}');
	});
	function editorSyn(ename){
		$.each(ueditor_loader[ename],function(i){
			this.sync(); 
		});
	}
	function load(prefix){		
		//获取网站导航的数据信息
		var navurl = prefix+"/admin/navmodel/json.shtml";
		$.post(navurl,null,function(data){
			var o = eval("("+data+")");
			var str = process(o[0],'');
			$("#navid").append(str).val(eval('${fl }'));
			
		},'json');
	}
	/**
	 * 设置导航数据显示的样式
	 * @param {Object} o
	 * @param str
	 */
	function process(o,str){
		var option="<option value='"+o.id+"'>"+str+o.text+"</option>";
		if(o.children){
			$(o.children).each(function(){
				option += process(this,str+"——");
			});
		}
		return option;
	}
</script>

<div class="pageContent">
	<form action="${pageContext.request.contextPath }/admin/article/editArticleInfo.shtml" class="pageForm required-validate" method="post" onsubmit="editorSyn('addart');return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent" layoutH="57">
			<dl>
				<dt>标题：</dt>
				<dd><input type="text" name="title" class="required" value="${obj.title }"/><input type="hidden" name="navTabId" value="article"/>
					<input type="hidden" name="id" value="${obj.id }"/>
					<select name="color" id="color">
					<c:forEach var="col" items="${artcleColors }">
						<option value="${col }" style="color:  ${col };">${col.name }</option>
					</c:forEach>
					</select>
				</dd>
				
			</dl>
			<dl>
				<dt>关键字：</dt>
				<dd><input type="text" name="keywords" title="文章的关键字 信息" value="${obj.keywords }"/></dd>				
			</dl>
			<dl>
				<dt>文章来源：</dt>
				<dd><input type="text" name="source" value="${obj.source }"/></dd>				
			</dl>
			<dl>
				<dt>发布时间：</dt>
				<dd><input type="text" name="modifyDate" class="date" value="<fmt:formatDate pattern="yyyy-MM-dd" value="${obj.modifyDate}" />"/></dd>				
			</dl>
			<dl>
				<dt>点击次数：</dt>
				<dd><input type="text" name="click" value="${obj.click }"/></dd>				
			</dl>
			<div class="divider"></div>
			<dl>
				<dt>首页显示：</dt>
				<dd><input type="checkbox" name="top" value="true" ${obj.top?"checked":"" }/>显示</dd>				
			</dl>
			<dl>
				<dt>文章显示：</dt>
				<dd><input type="checkbox" name="show" value="true" ${obj.show?"checked":"" }/>显示</dd>				
			</dl>
			<dl>
				<dt>图片新闻：</dt>
				<dd><input type="checkbox" name="hasPic" value="true" ${obj.hasPic?"checked":"" }/>是</dd>				
			</dl>
			<dl>
				<dt>审核状态：</dt>
				<dd><input type="checkbox" name="shenhe" value="true" ${obj.shenhe?"checked":"" }/>已审核</dd>				
			</dl>
			<div class="divider"></div>
			<dl class="nowrap">
				<dt>内容：</dt>
				<dd style="width:1000px;"><textarea class="editor" name="content" id="content" module="addart" height="150">${obj.content}</textarea></dd>

			</dl>
			<div class="divider"></div>
			<dl style="height: 150px;">
				<dt>所属栏目：</dt>
				<dd>
					<select multiple="multiple" name="navid" id="navid" style="height: 150px;" class="required"></select>
								
				</dd>
			</dl>
			<span class="input-notification attention png_bg">文章内容在网站上属于哪个模块,只能选择<font color='red'>最后的子模块</font>，按住Ctrl或Shift可以多选</span>
			<div class="divider"></div>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
</div>
